package mediatorPattern;

public class Tenant extends Colleague{

    public String name;
    private String requestedHouseInfo;    // 查看的房源信息

    public String getName() {
        return name;
    }

    public String getRequestedHouseInfo() {
        return requestedHouseInfo;
    }

    public Tenant(Mediator mediator, String name) {
        super(mediator);
        this.name = name;
    }

    // 接收房源信息
    public void receiveHouseInfo(String houseInfo) {
        System.out.println("租客 " + name + " 收到房源信息: " + houseInfo);
    }

    // 请求看房
    public void requestViewing(String houseInfo) {
        this.requestedHouseInfo = houseInfo;
        System.out.println("租客 " + name + " 请求看房: " + houseInfo);
        mediator.notify(this, "request_viewing");
    }

}
